﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ORMAC.Attributes;
using ORMAC.CodeGen.DBObjects;

namespace ORMAC.CodeGen
{
    [SQL(Query="select * from sys.tables")]
    public class TableInfo:DBObjectInfo
    {
        [PrimaryKey]
        [Field("object_id")]
        public int ObjectID{get;set;}
        /// <summary>
        /// List of table columns
        /// </summary>
        [Join(ParentCol = "object_id", ChildCol = "object_id")]
        public List<ColumnInfo> Columns { get; set; }
        //[Join(ParentCol = "Name", ChildCol = "FK_Table")]
        [ORMAC(AutoLoad=false)]
        public List<JoinInfo> Joins { get; set; }
        /// <summary>
        /// Contains a list of many2many relationships
        /// </summary>
        [ORMAC(AutoLoad = false)]
        public List<LinkTableInfo> LinkJoins { get; set; }

        [Join(ParentCol = "Name", ChildCol = "TABLE_NAME")]
        public List<PrimaryKeyInfo> PrimaryKeys { get; set; }
    }
}
